home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / pcr / pcr4_4.lha / DIST / debugnub / RDTProcs.c < prev    next >
C/C++ Source or Header  |  1991-06-17  |  19KB  |  730 lines

  1. /* begincopyright
  2.   Copyright (c) 1988 Xerox Corporation. All rights reserved.
  3.   Use and copying of this software and preparation of derivative works based
  4.   upon this software are permitted. Any distribution of this software or
  5.   derivative works must comply with all applicable United States export
  6.   control laws. This software is made available AS IS, and Xerox Corporation
  7.   makes no warranty about the software, its performance or its conformity to
  8.   any specification. Any person obtaining a copy of this software is requested
  9.   to send their name and post office or electronic mail address to:
  10.     PCR Coordinator
  11.     Xerox PARC
  12.     3333 Coyote Hill Rd.
  13.     Palo Alto, CA 94304
  14.   endcopyright */
  15.  
  16. /*
  17.  * RDTProcs.c
  18.  *
  19.  * Stubs for remote debug tool.
  20.  *
  21.  * Demers, February 20, 1990 9:19:13 am PST
  22.  */
  23.  
  24. #include "xr/BasicTypes.h"
  25. #include "xr/Errno.h"
  26. #include "xr/CirioNubTypes.h"
  27. #include "xr/CirioNubProtocol.h"
  28. #include "xr/CirioNubProcs.h"
  29. #include "xr/RDTRuntime.h"
  30. #include "xr/RDTProcs.h"
  31.  
  32.  
  33. #if (( RDT_PROCS_VERSION ) != ( CIRIO_NUB_PROCS_VERSION ))
  34.     --> RDT_PROCS_VERSION != CIRIO_NUB_PROCS_VERSION <--
  35. #endif
  36.  
  37. static char *
  38. RDT_CopyStr(str)
  39.     char *str;
  40. {
  41.     char *newStr = NIL;
  42.  
  43.     if( str != NIL ) {
  44.         int len1 = 1 + strlen(str);
  45.         newStr = (char *)malloc(len1);
  46.         bcopy(str, newStr, len1);
  47.     }
  48.     return newStr;
  49. }
  50.  
  51. #define RDT_FREE(p) if(((char *)(p)) != NIL) { free( ((char *)(p)) ); }
  52.  
  53.  
  54. int
  55. RDT_Null(desiredVersion, resultVersionPtr)
  56.     unsigned desiredVersion;
  57.     unsigned *resultVersionPtr;
  58. {
  59.     CirioNubRetCode rc;
  60.     unsigned argc;
  61.     unsigned buf[64];
  62.  
  63.     desiredVersion &= 0xffff; /* procs version only */
  64.     rc = RDT_PutCard32(
  65.             CIRIO_NUB_VERSION(CIRIO_NUB_PROTOCOL_VERSION, desiredVersion) );
  66.     if( rc == cnrc_ok ) {
  67.         rc = RDT_SendCall(CirioNubProcID_Null);
  68.     }
  69.     if( rc == cnrc_ok ) {
  70.         rc = RDT_ReadReply( buf, (sizeof buf), &argc );
  71.     }
  72.     if( rc == cnrc_ok ) {
  73.         if( argc == 1 ) {
  74.             (*resultVersionPtr) =
  75.                     ((unsigned)(buf[0])) & 0xffff; /* procs version only */
  76.         } else {
  77.             rc = cnrc_badArgs;
  78.         }
  79.     }
  80.     return ( (rc == cnrc_ok) ? 0 : (-1) );
  81. }
  82.  
  83.  
  84. int
  85. RDT_WaitSig(timeoutMsec, dbStatP)
  86.     unsigned timeoutMsec;
  87.     int *dbStatP;
  88. {
  89.     CirioNubRetCode rc;
  90.     bool gotSig;
  91.     unsigned argc;
  92.     unsigned buf[64];
  93.  
  94.     rc = RDT_PutCard32(timeoutMsec);
  95.     if( rc == cnrc_ok ) {
  96.         rc = RDT_SendCall(CirioNubProcID_WaitSig);
  97.     }
  98.     if( rc == cnrc_ok ) {
  99.         rc = RDT_ReadReply( buf, (sizeof buf), &argc );
  100.     }
  101.     if( rc == cnrc_ok ) {
  102.         if( argc == 2 ) {
  103.             gotSig = ((bool)(buf[0]));
  104.             (*dbStatP) = ((int)(buf[1]));
  105.         } else {
  106.             rc = cnrc_badArgs;
  107.         }
  108.     }
  109.     return ( (rc == cnrc_ok) ? (gotSig ? 0 : 1) : (-1) );
  110. }
  111.  
  112. int /* -err */
  113. RDT_SetDBStat (dbStat, timeoutMsec)
  114.     int dbStat;
  115.     unsigned timeoutMsec;
  116. {
  117.     CirioNubRetCode rc;
  118.     int ans;
  119.     unsigned argc;
  120.     unsigned buf[64];
  121.  
  122.     rc = RDT_PutInt32(dbStat);
  123.     if( rc == cnrc_ok ) {
  124.         rc = RDT_PutCard32(timeoutMsec);
  125.     }
  126.     if( rc == cnrc_ok ) {
  127.         rc = RDT_SendCall(CirioNubProcID_SetDBStat);
  128.     }
  129.     if( rc == cnrc_ok ) {
  130.         rc = RDT_ReadReply( buf, (sizeof buf), &argc );
  131.     }
  132.     if( rc == cnrc_ok ) {
  133.         if( argc == 1 ) {
  134.             ans = ((int)(buf[0]));
  135.         } else {
  136.             rc = cnrc_badArgs;
  137.         }
  138.     }
  139.     return ( (rc == cnrc_ok) ? ((ans == 0) ? 0 : 1) : (-1) );
  140. }
  141.  
  142.  
  143.  
  144. static int
  145. RDT_GetBlock(addr, nBytes, clientBuf, getProcID)
  146.     unsigned addr;
  147.     unsigned nBytes;
  148.     char *clientBuf;
  149.     unsigned getProcID;
  150. {
  151.     CirioNubRetCode rc;
  152.     int ans;
  153.     unsigned argc;
  154.     unsigned buf[2048];
  155.  
  156.     rc = RDT_PutCard32(addr);
  157.     if( rc == cnrc_ok ) {
  158.         rc = RDT_PutCard32(nBytes);
  159.     }
  160.     if( rc == cnrc_ok ) switch(getProcID) {
  161.         case CirioNubProcID_GetBytes:
  162.         case CirioNubProcID_GetWords16:
  163.         case CirioNubProcID_GetWords32:
  164.             break;
  165.         default:
  166.             rc = cnrc_protocol;
  167.             break;
  168.     }
  169.     if( rc == cnrc_ok ) {
  170.         rc = RDT_SendCall(getProcID);
  171.     }
  172.     if( rc == cnrc_ok ) {
  173.         rc = RDT_ReadReply( buf, (sizeof buf), &argc );
  174.     }
  175.     if( rc == cnrc_ok ) {
  176.         if( argc == 2 ) {
  177.             ans = ((int)(buf[0]));
  178.             if( ans > 0 ) {
  179.                 (void) bcopy( ((char *)(buf[1])), clientBuf, ans );
  180.             }
  181.         } else {
  182.             rc = cnrc_badArgs;
  183.         }
  184.     }
  185.     return ( (rc == cnrc_ok) ? ans : (-1) );
  186. }
  187.  
  188. int /* bytesRead or -err */
  189. RDT_GetBytes(addr, nBytes, clientBuf)
  190.     unsigned addr;
  191.     unsigned nBytes;
  192.     char *clientBuf;
  193. {
  194.     return RDT_GetBlock( addr, nBytes, clientBuf,
  195.             CirioNubProcID_GetBytes );
  196. }
  197.  
  198. int /* bytesRead or -err */
  199. RDT_GetWords16(addr, nBytes, clientBuf)
  200.     unsigned addr;
  201.     unsigned nBytes;
  202.     unsigned short *clientBuf;
  203. {
  204.     return RDT_GetBlock( addr, nBytes, ((char *)(clientBuf)),
  205.             CirioNubProcID_GetWords16 );
  206. }
  207.  
  208. int /* bytesRead or -err */
  209. RDT_GetWords32(addr, nBytes, clientBuf)
  210.     unsigned addr;
  211.     unsigned nBytes;
  212.     unsigned *clientBuf;
  213. {
  214.     return RDT_GetBlock( addr, nBytes, ((char *)(clientBuf)),
  215.             CirioNubProcID_GetWords32 );
  216. }
  217.  
  218.  
  219.  
  220. static int /* bytesPut or -err */
  221. RDT_PutBlock(addr, nBytes, clientBuf, putProcID)
  222.     unsigned addr;
  223.     unsigned nBytes;
  224.     char *clientBuf;
  225.     unsigned putProcID;
  226. {
  227.     CirioNubRetCode rc;
  228.     int ans = -1;
  229.     unsigned argc;
  230.     unsigned buf[64];
  231.  
  232.     rc = RDT_PutCard32(addr);
  233.     if( rc == cnrc_ok ) switch(putProcID) {
  234.         case CirioNubProcID_PutBytes:
  235.             rc = RDT_PutBlock8(clientBuf, nBytes);
  236.             break;
  237.         case CirioNubProcID_PutWords16:
  238.             rc = RDT_PutBlock16(((unsigned short *)(clientBuf)), nBytes);
  239.             break;
  240.         case CirioNubProcID_PutWords32:
  241.             rc = RDT_PutBlock32(((unsigned *)(clientBuf)), nBytes);
  242.             break;
  243.         default:
  244.             rc = cnrc_protocol;
  245.             break;
  246.     }
  247.     if( rc == cnrc_ok ) {
  248.         rc = RDT_SendCall(putProcID);
  249.     }
  250.     if( rc == cnrc_ok ) {
  251.         rc = RDT_ReadReply( buf, (sizeof buf), &argc );
  252.     }
  253.     if( rc == cnrc_ok ) {
  254.         if( argc != 1 ) rc = cnrc_badArgs;
  255.     }
  256.     if( rc == cnrc_ok ) {
  257.         if( (ans = ((int)(buf[0]))) == 0 ) ans = nBytes;
  258.     }
  259.     return ans;
  260. }
  261.  
  262.  
  263. int /* bytesPut or -err */
  264. RDT_PutBytes(addr, nBytes, clientBuf)
  265.     unsigned addr;
  266.     unsigned nBytes;
  267.     char *clientBuf;
  268. {
  269.     return RDT_PutBlock( addr, nBytes, clientBuf,
  270.             CirioNubProcID_PutBytes );
  271. }
  272.  
  273.  
  274. int /* bytesPut or -err */
  275. RDT_PutWords16(addr, nBytes, clientBuf)
  276.     unsigned addr;
  277.     unsigned nBytes;
  278.     unsigned short *clientBuf;
  279. {
  280.     return RDT_PutBlock( addr, nBytes, ((char *)(clientBuf)),
  281.             CirioNubProcID_PutWords16 );
  282. }
  283.  
  284.  
  285. int /* bytesPut or -err */
  286. RDT_PutWords32(addr, nBytes, clientBuf)
  287.     unsigned addr;
  288.     unsigned nBytes;
  289.     unsigned *clientBuf;
  290. {
  291.     return RDT_PutBlock( addr, nBytes, ((char *)(clientBuf)),
  292.             CirioNubProcID_PutWords32 );
  293. }
  294.  
  295.  
  296.  
  297. int /* -err */
  298. RDT_GetThread(index, dataPtr)
  299.     int index;
  300.     CirioNubThreadData *dataPtr;
  301. {
  302.     CirioNubRetCode rc;
  303.     int ans;
  304.     unsigned argc;
  305.     CirioNubThreadData fromData, toData;
  306.     unsigned buf[1024];
  307.  
  308.     if( index > 0 ) index = (-index);
  309.     rc = RDT_PutInt32(index);
  310.     if( rc == cnrc_ok ) {
  311.         rc = RDT_PutInt32(0);
  312.     }
  313.     if( rc == cnrc_ok ) {
  314.         rc = RDT_SendCall(CirioNubProcID_GetThreads);
  315.     }
  316.     if( rc == cnrc_ok ) {
  317.         rc = RDT_ReadReply( buf, (sizeof buf), &argc );
  318.     }
  319.     if( rc == cnrc_ok ) {
  320.         if( argc == 2 ) {
  321.             switch( ((unsigned)(buf[0])) ) {
  322.                 case 0:
  323.                     ans = 1;
  324.                     break;
  325.                 case (sizeof (**dataPtr)):
  326.                     fromData = ((CirioNubThreadData)(buf[1]));
  327.                     toData = ( (CirioNubThreadData)
  328.                            (malloc( sizeof (*fromData) )) );
  329.                     (void) bcopy( fromData, toData, (sizeof (*fromData)) );
  330.                     /* no strings to copy */
  331.                     *dataPtr = toData;
  332.                     ans = 0;
  333.                     break;
  334.                 default:
  335.                     rc = cnrc_badArgs;
  336.                     break;
  337.             }
  338.         } else {
  339.             rc = cnrc_badArgs;
  340.         }
  341.     }
  342.     return ( (rc == cnrc_ok) ? ans : (-1) );
  343. }
  344.  
  345. void
  346. RDT_FreeThreadData(dataPtr)
  347.     CirioNubThreadData *dataPtr;
  348. {
  349.     RDT_FREE(*dataPtr);
  350.     *dataPtr = NIL;
  351. }
  352.  
  353. static CirioNubPCInfo /* NIL on failure */
  354. RDT_CopyPCInfoBuf(buf, argc, pos)
  355.     unsigned *buf;
  356.     unsigned argc;
  357.     unsigned pos;
  358. {
  359.     CirioNubPCInfo toInfo;
  360.  
  361.     if( argc < (pos+6) ) return NIL;
  362.     toInfo = ( (CirioNubPCInfo)(malloc( sizeof (*toInfo) )) );
  363.     toInfo->procName = RDT_CopyStr( ((char *)(buf[pos])) );  pos += 1;
  364.     toInfo->procSymID = ((unsigned)(buf[pos]));  pos += 1;
  365.     toInfo->fileName = RDT_CopyStr( ((char *)(buf[pos])) );  pos += 1;
  366.     toInfo->fileSeqNum = ((unsigned)(buf[pos]));  pos += 1;
  367.     toInfo->guessedEmbeddedFileName = RDT_CopyStr( ((char *)(buf[pos])) );
  368.             pos += 1;
  369.     toInfo->guessedEmbeddedFileSymID = ((unsigned)(buf[pos]));
  370.     return toInfo;
  371. }
  372.  
  373.  
  374. int /* -err */
  375. RDT_PCtoInfo (pc, infoPtr)
  376.     unsigned pc;
  377.     CirioNubPCInfo *infoPtr;
  378. {
  379.     CirioNubRetCode rc;
  380.     unsigned argc;
  381.     CirioNubPCInfo toInfo;
  382.     unsigned buf[1024];
  383.  
  384.     rc = RDT_PutCard32(pc);
  385.     if( rc == cnrc_ok ) {
  386.         rc = RDT_SendCall(CirioNubProcID_PCtoInfo);
  387.     }
  388.     if( rc == cnrc_ok ) {
  389.         rc = RDT_ReadReply( buf, (sizeof buf), &argc );
  390.     }
  391.     if( rc == cnrc_ok ) {
  392.         if( argc == 6 ) {
  393.             (*infoPtr) = RDT_CopyPCInfoBuf(buf, argc, 0);
  394.             if( (*infoPtr) == NIL ) rc = cnrc_badArgs;
  395.         } else {
  396.             rc = cnrc_badArgs;
  397.         }
  398.     }
  399.     return ( (rc == cnrc_ok) ? 0 : (-1) );
  400.  
  401. }
  402.  
  403.  
  404. void
  405. RDT_FreePCInfo(infoPtr)
  406.     CirioNubPCInfo *infoPtr;
  407. {
  408.     CirioNubPCInfo info;
  409.  
  410.     if( (info= *infoPtr) != NIL ) {
  411.         RDT_FREE(info->procName);
  412.         RDT_FREE(info->fileName);
  413.         RDT_FREE(info->guessedEmbeddedFileName);
  414.         free(info);
  415.     }
  416.     *infoPtr = NIL;
  417.  
  418.  
  419. int
  420. RDT_KillWorld()
  421. {
  422.     CirioNubRetCode rc;
  423.     unsigned argc;
  424.     unsigned buf[64];
  425.  
  426.     rc = RDT_SendCall(CirioNubProcID_KillWorld);
  427.     if( rc == cnrc_ok ) {
  428.         rc = RDT_ReadReply( buf, (sizeof buf), &argc );
  429.     }
  430.     if( rc == cnrc_ok ) {
  431.         if( argc == 0 ) {
  432.             ;
  433.         } else {
  434.             rc = cnrc_badArgs;
  435.         }
  436.     }
  437.     return ( (rc == cnrc_ok) ? 0 : (-1) );
  438. }
  439.  
  440.  
  441. int /* -err */
  442. RDT_IssueThreadCommand(threadIndex, setFreeze, freeze, setMsg, msg)
  443.     int threadIndex;
  444.     bool setFreeze;
  445.     bool freeze;
  446.     bool setMsg;
  447.     int msg;
  448. {
  449.     CirioNubRetCode rc;
  450.     int ans;
  451.     unsigned argc;
  452.     unsigned buf[128];
  453.  
  454.     rc = RDT_PutInt32(threadIndex);
  455.     if( rc == cnrc_ok ) {
  456.         rc = RDT_PutInt32(((int)(setFreeze)));
  457.     }
  458.     if( rc == cnrc_ok ) {
  459.         rc = RDT_PutInt32(((int)(freeze)));
  460.     }
  461.     if( rc == cnrc_ok ) {
  462.         rc = RDT_PutInt32(((int)(setMsg)));
  463.     }
  464.     if( rc == cnrc_ok ) {
  465.         rc = RDT_PutInt32(msg);
  466.     }
  467.     if( rc == cnrc_ok ) {
  468.         rc = RDT_SendCall(CirioNubProcID_IssueThreadCommand);
  469.     }
  470.     if( rc == cnrc_ok ) {
  471.         rc = RDT_ReadReply( buf, (sizeof buf), &argc );
  472.     }
  473.     if( rc == cnrc_ok ) {
  474.         if( argc == 1 ) {
  475.             ans = ((int)(buf[0]));
  476.         } else {
  477.             rc = cnrc_badArgs;
  478.         }
  479.     }
  480.     return ( (rc == cnrc_ok) ? ans : (-1) );
  481. }
  482.  
  483. int /* 0, 1, -err */
  484. RDT_GetDBStat (timeoutMsec, indexPtr, dbStatPtr)
  485.     unsigned timeoutMsec;
  486.     int *indexPtr;
  487.     int *dbStatPtr;
  488. {
  489.     CirioNubRetCode rc;
  490.     unsigned argc;
  491.     unsigned buf[128];
  492.  
  493.     rc = RDT_PutInt32(*dbStatPtr);
  494.     if( rc == cnrc_ok ) {
  495.         rc = RDT_PutInt32(*indexPtr);
  496.     }
  497.     if( rc == cnrc_ok ) {
  498.         rc = RDT_PutCard32(timeoutMsec);
  499.     }
  500.     if( rc == cnrc_ok ) {
  501.         rc = RDT_SendCall(CirioNubProcID_GetDBStat);
  502.     }
  503.     if( rc == cnrc_ok ) {
  504.         rc = RDT_ReadReply( buf, (sizeof buf), &argc );
  505.     }
  506.     if( rc == cnrc_ok ) {
  507.         if( argc == 2 ) {
  508.             (*dbStatPtr) = ((int)(buf[0]));
  509.             (*indexPtr) = ((int)(buf[1]));
  510.         } else {
  511.             rc = cnrc_badArgs;
  512.         }
  513.     }
  514.     return ( (rc == cnrc_ok) ? 0 : (-1) );
  515. }
  516.  
  517.  
  518. static CirioNubFileEntry /* NIL on failure */
  519. RDT_CopyFileEntryFromBuf(buf, argc, pos)
  520.     unsigned *buf;
  521.     unsigned argc;
  522.     unsigned pos;
  523. {
  524.     CirioNubFileEntry toFileEntry;
  525.  
  526.     if( argc < (pos+22) ) return NIL;
  527.     toFileEntry = ((CirioNubFileEntry)(malloc(sizeof (*toFileEntry) )));
  528.     toFileEntry->seqNum = ((unsigned)(buf[pos]));  pos += 1;
  529.     toFileEntry->commitPoint = ((bool)(buf[pos]));  pos += 1;
  530.     toFileEntry->fileName = RDT_CopyStr( ((char *)(buf[pos])) );  pos += 1;
  531.     toFileEntry->fOffset = ((unsigned)(buf[pos]));  pos += 1;
  532.     toFileEntry->fMagic = ((unsigned)(buf[pos]));  pos += 1;
  533.     toFileEntry->size = ((size_t)(buf[pos]));  pos += 1;
  534.     toFileEntry->mTime = ((time_t)(buf[pos]));  pos += 1;
  535.     toFileEntry->sMagic = ((unsigned)(buf[pos]));  pos += 1;
  536.     toFileEntry->stamp = ((XR_Pointer)(buf[pos]));  pos += 1;
  537.     toFileEntry->stampSize = ((unsigned)(buf[pos]));  pos += 1;
  538.     toFileEntry->readerData = ((XR_Pointer)(buf[pos]));  pos += 1;
  539.     toFileEntry->readerDataSize = ((unsigned)(buf[pos]));  pos += 1;
  540.     toFileEntry->patchReloc = ((XR_Pointer)(buf[pos]));  pos += 1;
  541.     toFileEntry->patchSize = ((unsigned)(buf[pos]));  pos += 1;
  542.     toFileEntry->textReloc = ((XR_Pointer)(buf[pos]));  pos += 1;
  543.     toFileEntry->textSize = ((unsigned)(buf[pos]));  pos += 1;
  544.     toFileEntry->dataReloc = ((XR_Pointer)(buf[pos]));  pos += 1;
  545.     toFileEntry->dataSize = ((unsigned)(buf[pos]));  pos += 1;
  546.     toFileEntry->bssReloc = ((XR_Pointer)(buf[pos]));  pos += 1;
  547.     toFileEntry->bssSize = ((unsigned)(buf[pos]));  pos += 1;
  548.     toFileEntry->commonReloc = ((XR_Pointer)(buf[pos]));  pos += 1;
  549.     toFileEntry->commonSize = ((unsigned)(buf[pos]));  pos += 1;
  550.     return toFileEntry;
  551. }
  552.  
  553. int /* -err */
  554. RDT_GetFileEntry(seqNum, fileEntryPtr)
  555.     unsigned seqNum;
  556.     CirioNubFileEntry *fileEntryPtr;
  557.  
  558. {
  559.     CirioNubRetCode rc;
  560.     int ans;
  561.     CirioNubFileEntry toFileEntry;
  562.     unsigned argc;
  563.     unsigned buf[1024];
  564.  
  565.     rc = RDT_PutCard32(seqNum);
  566.     if( rc == cnrc_ok ) {
  567.         rc = RDT_SendCall(CirioNubProcID_GetFileEntry);
  568.     }
  569.     if( rc == cnrc_ok ) {
  570.         rc = RDT_ReadReply( buf, (sizeof buf), &argc );
  571.     }
  572.     if( rc == cnrc_ok ) {
  573.         (*fileEntryPtr) = RDT_CopyFileEntryFromBuf(buf, argc, 0);
  574.         if( (*fileEntryPtr) != NIL ) {
  575.             ;
  576.         } else {
  577.             rc = cnrc_badArgs;
  578.         }
  579.     }
  580.     return ( (rc == cnrc_ok) ? 0 : (-1) );
  581. }
  582.  
  583.  
  584. void
  585. RDT_FreeFileEntry(fileEntryPtr)
  586.     CirioNubFileEntry *fileEntryPtr;
  587. {
  588.     CirioNubFileEntry fe;
  589.  
  590.     if( (fe = *fileEntryPtr) != NIL ) {
  591.         RDT_FREE(fe->fileName);
  592.         free(fe);
  593.         *fileEntryPtr = NIL;
  594.     }
  595. }
  596.  
  597.  
  598. static CirioNubSymEntry
  599. RDT_CopySymEntryFromBuf(buf, argc, pos)
  600.     unsigned *buf;
  601.     unsigned argc;
  602.     unsigned pos;
  603. {
  604.     CirioNubSymEntry toSymEntry;
  605.  
  606.     if( argc < (pos+6) ) return NIL;
  607.     toSymEntry = ((CirioNubSymEntry)(malloc(sizeof (*toSymEntry) )));
  608.     toSymEntry->symID = ((unsigned)(buf[pos]));  pos += 1;
  609.     toSymEntry->name = RDT_CopyStr( ((char *)(buf[pos])) );  pos += 1;
  610.     toSymEntry->type = ((unsigned)(buf[pos]));  pos += 1;
  611.     toSymEntry->value = ((unsigned)(buf[pos]));  pos += 1;
  612.     toSymEntry->size = ((unsigned)(buf[pos]));  pos += 1;
  613.     toSymEntry->fileSeqNum = ((unsigned)(buf[pos]));  pos += 1;
  614.     return toSymEntry;
  615. }
  616.  
  617.  
  618. int /* -err */
  619. RDT_GetMatchingSymEntryByName( symID, pattern, caseSensitive, wantedTypes, 
  620.         ignoredClasses, numToSkip, symEntryPtr )
  621.     unsigned symID;
  622.     char *pattern;
  623.     bool caseSensitive;
  624.     unsigned wantedTypes;
  625.     unsigned ignoredClasses;
  626.     int numToSkip;
  627.     CirioNubSymEntry *symEntryPtr;
  628. {
  629.     CirioNubRetCode rc;
  630.     unsigned argc;
  631.     unsigned buf[2048];
  632.  
  633.     rc = RDT_PutCard32(symID);
  634.     if( rc == cnrc_ok ) {
  635.         rc = RDT_PutString(pattern);
  636.     }
  637.     if( rc == cnrc_ok ) {
  638.         rc = RDT_PutInt32(((int)(caseSensitive)));
  639.     }
  640.     if( rc == cnrc_ok ) {
  641.         rc = RDT_PutCard32(wantedTypes);
  642.     }
  643.     if( rc == cnrc_ok ) {
  644.         rc = RDT_PutCard32(ignoredClasses);
  645.     }
  646.     if( rc == cnrc_ok ) {
  647.         rc = RDT_PutInt32(numToSkip);
  648.     }
  649.     if( rc == cnrc_ok ) {
  650.         rc = RDT_SendCall(CirioNubProcID_GetMatchingSymEntryByName);
  651.     }
  652.     if( rc == cnrc_ok ) {
  653.         rc = RDT_ReadReply( buf, (sizeof buf), &argc );
  654.     }
  655.     if( rc == cnrc_ok ) {
  656.         if( argc >  0 ) {
  657.             if( ((int)(buf[0])) == 0 ) {
  658.                 (*symEntryPtr) = RDT_CopySymEntryFromBuf(buf, argc, 0);
  659.                 if( (*symEntryPtr) != NIL ) {
  660.                     ;
  661.                 } else {
  662.                     rc = cnrc_badArgs;
  663.                 }
  664.             } else {
  665.                 (*symEntryPtr) = NIL;
  666.             }
  667.         } else {
  668.             rc = cnrc_badArgs;
  669.         }
  670.     }
  671.     return ( (rc == cnrc_ok) ? 0 : (-1) );
  672. }
  673.  
  674.  
  675. int /* -err */
  676. RDT_GetMatchingSymEntryByValue( symID, val, wantedTypes, ignoredClasses,
  677.         numToSkip, symEntryPtr )
  678.     unsigned symID;
  679.     unsigned val;
  680.     unsigned wantedTypes;
  681.     unsigned ignoredClasses;
  682.     int numToSkip;
  683.     CirioNubSymEntry *symEntryPtr;
  684. {
  685.     CirioNubRetCode rc;
  686.     int ans;
  687.     CirioNubFileEntry toFileEntry;
  688.     unsigned argc;
  689.     unsigned buf[2048];
  690.  
  691.     rc = RDT_PutCard32(symID);
  692.     if( rc == cnrc_ok ) {
  693.         rc = RDT_PutCard32(val);
  694.     }
  695.     if( rc == cnrc_ok ) {
  696.         rc = RDT_PutCard32(wantedTypes);
  697.     }
  698.     if( rc == cnrc_ok ) {
  699.         rc = RDT_PutCard32(ignoredClasses);
  700.     }
  701.     if( rc == cnrc_ok ) {
  702.         rc = RDT_PutInt32(numToSkip);
  703.     }
  704.     if( rc == cnrc_ok ) {
  705.         rc = RDT_SendCall(CirioNubProcID_GetMatchingSymEntryByValue);
  706.     }
  707.     if( rc == cnrc_ok ) {
  708.         rc = RDT_ReadReply( buf, (sizeof buf), &argc );
  709.     }
  710.     if( rc == cnrc_ok ) {
  711.         if( argc >  0 ) {
  712.             if( ((int)(buf[0])) == 0 ) {
  713.                 (*symEntryPtr) = RDT_CopySymEntryFromBuf(buf, argc, 0);
  714.                 if( (*symEntryPtr) != NIL ) {
  715.                     ;
  716.                 } else {
  717.                     rc = cnrc_badArgs;
  718.                 }
  719.             } else {
  720.                 (*symEntryPtr) = NIL;
  721.             }
  722.         } else {
  723.             rc = cnrc_badArgs;
  724.         }
  725.     }
  726.     return ( (rc == cnrc_ok) ? 0 : (-1) );
  727. }
  728.  
  729.